<template>
  <div></div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  name: 'Jump',
  data () {
    return {}
  },
  computed: {
    ...mapState({
      menu: state => state.system.menu
    })
  },
  async created () {
    await this.$store.dispatch('system/auth')
    if (this.menu.length > 0) {
      this.$router.push(this.getPath(this.menu[0]))
    } else {
      this.$router.push('/login')
    }
  },
  methods: {
    getPath (data) {
      if (data.path != null) {
        return data.path
      } else {
        return this.getPath(data.children[0])
      }
    }
  }
}
</script>